package com.heima.dome1;

import com.heima.domain.Employee;

import java.util.Comparator;
import java.util.TreeSet;

public class TestEmployee {
    public static void main(String[] args) {
        TreeSet<Employee> ts=new TreeSet<>(new Comparator<Employee>() {
            @Override
            public int compare(Employee o1, Employee o2) {
                int result=o2.getSalary()-o1.getSalary();
                result=result==0?o1.getAge()-o2.getAge():result;
                result=result==0?o1.name.compareTo(o2.name):result;
                return result;
            }
        });

        Employee e1=new Employee("zhangsan",20,15000);
        Employee e2=new Employee("oisisdds",18,10000);
        Employee e3=new Employee("wangwu",18,10000);
        Employee e4=new Employee("zhaoliu",17,10000);
        Employee e5=new Employee("xiaoqi",21,11000);

        ts.add(e1);
        ts.add(e2);
        ts.add(e3);
        ts.add(e4);
        ts.add(e5);

        System.out.println(ts);
    }
}
